package com.millet.interview;

import java.util.Scanner;

/**
 * @author ZhangyiA
 * @describe:
 * @date 2021/07/03
 */

public class One_MatrixMultiply {

    public int[][] readData(Scanner input , int n , int m){
        int[][] matrix = new int[n][m];
        for(int i = 0 ; i < n ; i ++){
            for(int j = 0 ; j < m ; j ++){
                matrix[i][j] = input.nextInt();
            }
        }
        return matrix;
    }

    public void matrix_multiply_opt(int[][] A , int[][] B , int[][] C , int M , int K , int N){
        for(int k = 0 ; k < K ; k ++){
            for(int i = 0 ; i < M ; i ++){
                int r = A[i][k];
                for(int j = 0 ; j < N ; j ++){
                    C[i][j] += r * B[k][j];
                }
            }
        }
    }

    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        One_MatrixMultiply data = new One_MatrixMultiply();
        int M = input.nextInt();
        int K = input.nextInt();
        int N = input.nextInt();
        int[][] A = data.readData(input , M , K);
        int[][] B = data.readData(input , K , N);
        int[][] C = new int[M][N];
        data.matrix_multiply_opt(A , B , C , M , K , N);
        for(int i = 0 ; i < M ; i ++){
            for(int j = 0 ; j < N ; j ++){
                System.out.print(C[i][j] + "  ");
            }
            System.out.println();
        }
    }

}
/*
2 3 2
1 2 3
1 2 3
1 1
2 2
3 3
* */